<script setup>

const props = defineProps({
    list:Array,
    value:Number
})
const emit = defineEmits(["update:value"])
const onClick = (item)=>{
    emit("update:value",item.value)
}
</script>

<template>
    <div class="select-container">
        <div :class="['card',value==item.value?'card-active':'']" v-for="item,index in list" @click="onClick(item)">
            {{item.text}}
        </div>
    </div>
</template>

<style scoped>
.select-container{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 10px;
}
.card{
    padding: 0px 15px;
    background-color: rgb(243, 243, 243);
    border-radius: 4px;
    margin-right: 5px;
    margin-bottom: 5px;
    transition: all 0.3s;
}
.card-active{
    background-color: var(--light-color);
    color: white;
}
</style>